import type { IModalConfig } from '@/global/types'

export const modalEditAndAddConfig: IModalConfig = {
  pageName: 'menu',
  type: 'drawer',
  layout: {
    title: '填写菜单数据',
    size: '45%',
    showClose: true, // 是否显示右上角关闭图标
    closeOnClickModal: false // 点击遮罩层是否能关闭对话框
  },
  form: {
    layout: {
      isShowBtns: false,
      labelWidth: '80px',
      size: 'default'
    },
    items: [
      {
        type: 'custom',
        slotName: 'parentName',
        prop: 'parentName',
        span: 24,
        label: '上级菜单',
        placeholder: '请选择上级菜单'
      },
      {
        type: 'radio',
        prop: 'type',
        span: 24,
        label: '类型',
        options: [
          { value: '0', label: '目录' },
          { value: '1', label: '菜单' },
          { value: '2', label: '按钮' }
        ]
      },
      {
        type: 'input',
        prop: 'icon',
        span: 24,
        label: '菜单图标',
        placeholder: '请输入菜单图标'
      },
      {
        type: 'input',
        prop: 'menuLabel',
        span: 12,
        label: '菜单名称',
        placeholder: '请输入菜单名称'
      },
      {
        type: 'input',
        prop: 'path',
        span: 12,
        label: '路由地址',
        placeholder: '请输入路由地址'
      },
      {
        type: 'input',
        prop: 'name',
        span: 12,
        label: '路由名称',
        placeholder: '请输入路由名称'
      },
      {
        type: 'input',
        prop: 'url',
        span: 12,
        label: '组件路径',
        placeholder: '请输入组件路径'
      },
      {
        type: 'input',
        prop: 'menuCode',
        span: 12,
        label: '权限字段',
        placeholder: '请输入权限字段'
      }
    ],
    rules: {
      menuCode: [
        {
          required: true,
          message: '权限字段不能为空',
          trigger: 'blur'
        }
      ],
      parentName: [
        {
          required: true,
          message: '',
          trigger: 'blur'
        }
      ],
      menuLabel: [
        {
          required: true,
          message: '菜单名称不能为空',
          trigger: 'blur'
        }
      ]
    }
  }
}

export default modalEditAndAddConfig
